/**
 * <copyright>
 * Copyrigth 2007 Aurelien Moreau
 *
 * This file is part of ProcessShop.
 *
 * ProcessShop is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * ProcessShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with ProcessShop; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 * </copyright>
 *
 * $Id$
 */
package net.yienyien.process.folder.stdPatterns.impl;

import net.yienyien.process.bpd.BpdPackage;
import net.yienyien.process.folder.artifacts.ArtifactsPackage;
import net.yienyien.process.folder.artifacts.impl.ArtifactsPackageImpl;
import net.yienyien.process.folder.stdPatterns.Flow;
import net.yienyien.process.folder.stdPatterns.Other;
import net.yienyien.process.folder.stdPatterns.Pick;
import net.yienyien.process.folder.stdPatterns.Repeat;
import net.yienyien.process.folder.stdPatterns.RepeatWhile;
import net.yienyien.process.folder.stdPatterns.Sequence;
import net.yienyien.process.folder.stdPatterns.StdBPDPattern;
import net.yienyien.process.folder.stdPatterns.StdPatternsFactory;
import net.yienyien.process.folder.stdPatterns.StdPatternsPackage;
import net.yienyien.process.folder.stdPatterns.Switch;
import net.yienyien.process.folder.stdPatterns.SynchronizingProcess;
import net.yienyien.process.folder.stdPatterns.While;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.impl.EPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class StdPatternsPackageImpl extends EPackageImpl implements StdPatternsPackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass stdBPDPatternEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass flowEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass otherEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass pickEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass repeatEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass repeatWhileEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass sequenceEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass switchEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass synchronizingProcessEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass whileEClass = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see net.yienyien.process.folder.stdPatterns.StdPatternsPackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private StdPatternsPackageImpl() {
		super(eNS_URI, StdPatternsFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this
	 * model, and for any others upon which it depends.  Simple
	 * dependencies are satisfied by calling this method on all
	 * dependent packages before doing anything else.  This method drives
	 * initialization for interdependent packages directly, in parallel
	 * with this package, itself.
	 * <p>Of this package and its interdependencies, all packages which
	 * have not yet been registered by their URI values are first created
	 * and registered.  The packages are then initialized in two steps:
	 * meta-model objects for all of the packages are created before any
	 * are initialized, since one package's meta-model objects may refer to
	 * those of another.
	 * <p>Invocation of this method will not affect any packages that have
	 * already been initialized.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static StdPatternsPackage init() {
		if (isInited) return (StdPatternsPackage)EPackage.Registry.INSTANCE.getEPackage(StdPatternsPackage.eNS_URI);

		// Obtain or create and register package
		StdPatternsPackageImpl theStdPatternsPackage = (StdPatternsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof StdPatternsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new StdPatternsPackageImpl());

		isInited = true;

		// Initialize simple dependencies
		BpdPackage.eINSTANCE.eClass();
		EcorePackage.eINSTANCE.eClass();

		// Obtain or create and register interdependencies
		ArtifactsPackageImpl theArtifactsPackage = (ArtifactsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ArtifactsPackage.eNS_URI) instanceof ArtifactsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ArtifactsPackage.eNS_URI) : ArtifactsPackage.eINSTANCE);

		// Create package meta-data objects
		theStdPatternsPackage.createPackageContents();
		theArtifactsPackage.createPackageContents();

		// Initialize created meta-data
		theStdPatternsPackage.initializePackageContents();
		theArtifactsPackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theStdPatternsPackage.freeze();

		return theStdPatternsPackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getStdBPDPattern() {
		return stdBPDPatternEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getFlow() {
		return flowEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getOther() {
		return otherEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getPick() {
		return pickEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getRepeat() {
		return repeatEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getRepeatWhile() {
		return repeatWhileEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getSequence() {
		return sequenceEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getSwitch() {
		return switchEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getSynchronizingProcess() {
		return synchronizingProcessEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getWhile() {
		return whileEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public StdPatternsFactory getStdPatternsFactory() {
		return (StdPatternsFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		stdBPDPatternEClass = createEClass(STD_BPD_PATTERN);

		flowEClass = createEClass(FLOW);

		otherEClass = createEClass(OTHER);

		pickEClass = createEClass(PICK);

		repeatEClass = createEClass(REPEAT);

		repeatWhileEClass = createEClass(REPEAT_WHILE);

		sequenceEClass = createEClass(SEQUENCE);

		switchEClass = createEClass(SWITCH);

		synchronizingProcessEClass = createEClass(SYNCHRONIZING_PROCESS);

		whileEClass = createEClass(WHILE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		ArtifactsPackage theArtifactsPackage = (ArtifactsPackage)EPackage.Registry.INSTANCE.getEPackage(ArtifactsPackage.eNS_URI);
		BpdPackage theBpdPackage = (BpdPackage)EPackage.Registry.INSTANCE.getEPackage(BpdPackage.eNS_URI);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes
		stdBPDPatternEClass.getESuperTypes().add(theArtifactsPackage.getBPDPattern());
		flowEClass.getESuperTypes().add(this.getStdBPDPattern());
		otherEClass.getESuperTypes().add(this.getStdBPDPattern());
		pickEClass.getESuperTypes().add(this.getStdBPDPattern());
		repeatEClass.getESuperTypes().add(this.getStdBPDPattern());
		repeatWhileEClass.getESuperTypes().add(this.getStdBPDPattern());
		sequenceEClass.getESuperTypes().add(this.getStdBPDPattern());
		switchEClass.getESuperTypes().add(this.getStdBPDPattern());
		synchronizingProcessEClass.getESuperTypes().add(this.getStdBPDPattern());
		whileEClass.getESuperTypes().add(this.getStdBPDPattern());

		// Initialize classes and features; add operations and parameters
		initEClass(stdBPDPatternEClass, StdBPDPattern.class, "StdBPDPattern", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		EOperation op = addEOperation(stdBPDPatternEClass, theBpdPackage.getBPDObject(), "getContent", 0, -1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theBpdPackage.getBPDObject(), "source", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, theBpdPackage.getBPDObject(), "sink", 0, 1, IS_UNIQUE, IS_ORDERED);

		op = addEOperation(stdBPDPatternEClass, ecorePackage.getEBoolean(), "verify", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, theBpdPackage.getBPDComponent(), "component", 0, 1, IS_UNIQUE, IS_ORDERED);

		initEClass(flowEClass, Flow.class, "Flow", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(otherEClass, Other.class, "Other", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(pickEClass, Pick.class, "Pick", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(repeatEClass, Repeat.class, "Repeat", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(repeatWhileEClass, RepeatWhile.class, "RepeatWhile", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(sequenceEClass, Sequence.class, "Sequence", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(switchEClass, Switch.class, "Switch", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(synchronizingProcessEClass, SynchronizingProcess.class, "SynchronizingProcess", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(whileEClass, While.class, "While", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		// Create resource
		createResource(eNS_URI);
	}

} //StdPatternsPackageImpl
